package main

import "fmt"

// 多返回值,匿名
func foo(a string, b int) (int, int) {
	fmt.Println(a)
	return b, 200
}

// 多返回值，命名
func foo2(a string, b int) (r1 int, r2 int) {
	fmt.Println(a)
	r1 = b

	r2 = 400
	return
}

// 返回值类型相同，可省略,命名的返回值有默认值
func foo3(a string, b int) (r1, r2 int) {
	fmt.Println(a,b)
	return
}

func returnValue() {
	ret1, ret2 := foo("hello", 100)
	fmt.Println("ret1=", ret1, " ret2=", ret2)

	ret1, ret2 = foo2("world", 300)
	fmt.Println("ret1=", ret1, " ret2=", ret2)

	ret1, ret2 = foo3("world", 400)
	fmt.Println("ret1=", ret1, " ret2=", ret2)
}
